//
//  BlackHoleView.swift
//  Draw方法的逐步帧动画效果
//
//  Created by app on 2017/4/13.
//  Copyright © 2017年 app. All rights reserved.
//

import UIKit

class BlackHoleView: UIView {

    var blackHoleRadius:Float = 0
    
    func blackHoleIncrease(_ radius:Float) {
        blackHoleRadius = radius
        setNeedsDisplay()
    }
    
    override func draw(_ rect: CGRect) {
        
        // 获得当前画布
        let ctx = UIGraphicsGetCurrentContext()
        ctx?.addArc(center: self.center,
                    radius: CGFloat(blackHoleRadius),
                    startAngle: 0,
                    endAngle: CGFloat(M_PI * 2),
                    clockwise: false
        )
        ctx?.fillPath()
    }
}
